update Attributes via dxl script

Hello together,

I'm new at the forum and have a big problem with my work with doors:

In on project I have created attributes which point to a type for the use in a drop down list (have a look at the picture in the attachement). I have copied this attribute to several projects. Now these types had an update and I need to update them in all projects. Is there a possibility to update all projects with a dxl script?

Would be great if someone could help me.

Greets,

Manuel
Manulito - Tue Jun 14 02:38:17 EDT 2011

Re: update Attributes via dxl script
SystemAdmin - Tue Jun 14 03:51:01 EDT 2011

Depending on what you want to change, this can be a very complicated task, it requires great care - One of the past owners of DOORS, Telelogic, developed a script that can help with this as part of their Kitchen\PSToolBox suite of scripts. I have attached a copy of the script - it doesn't seem to rely on any #includes, so it should work as it is. The dialogue window has a check box to limited this script to just the current folder, deselect this to make it apply to the current project.

It is highly recommended that you test this on a copy of the project to make sure that you understand how this works and that it make changes according to your expectations. I don't know what sort of changes you are wanting to make so experiment first to make sure it does what you expect it to do. In particular, be careful with removing or changing the text of existing enumerated elements, this will the an effect of removing these from objects that have selected these elements as values for that attribute - they will not appear in history as being deleted, they will just disappear without any trace - so be careful.


Paul Miller
Melbourne, Australia
Attachments

attachment_14627464_CopyAttrsPlus_v2.dxl

Re: update Attributes via dxl script
Manulito - Tue Jun 14 04:51:02 EDT 2011

SystemAdmin - Tue Jun 14 03:51:01 EDT 2011
Depending on what you want to change, this can be a very complicated task, it requires great care - One of the past owners of DOORS, Telelogic, developed a script that can help with this as part of their Kitchen\PSToolBox suite of scripts. I have attached a copy of the script - it doesn't seem to rely on any #includes, so it should work as it is. The dialogue window has a check box to limited this script to just the current folder, deselect this to make it apply to the current project.

It is highly recommended that you test this on a copy of the project to make sure that you understand how this works and that it make changes according to your expectations. I don't know what sort of changes you are wanting to make so experiment first to make sure it does what you expect it to do. In particular, be careful with removing or changing the text of existing enumerated elements, this will the an effect of removing these from objects that have selected these elements as values for that attribute - they will not appear in history as being deleted, they will just disappear without any trace - so be careful.


Paul Miller
Melbourne, Australia

Hey Paul,

thank you so much for this very fast answer and it works like honey milk. Love it!

Thanks a lot!

Cheers,

Manuel

Re: update Attributes via dxl script
Manulito - Mon Aug 29 09:17:53 EDT 2011

Hello again,

the script worked until now with now problems. But now I have a problem with the update of types from one module to another if there are already types available. The script deletes the types in the target module and writes the types out of the source module into the target module. But I want to keep the types which are already inside the source module.

I think I have to modify this part of the script, but can't get it working:
//=================================================================================================
// Creates types for use by attributes yet to be created in the target module.
//
// Called by: copyAtts
//
// Calls: storeMsg
//
bool createType(Module srcMod, Module destMod, string nameOfType) {
bool boundSet, passed = false
string errMsg = null
AttrType destAttType
AttrType attType = find(srcMod, nameOfType)
string baseType = attType.type ""
current = destMod
if (baseType == "Real") {
destAttType = create(attType.name, attrReal, errMsg)
boundSet = attType.minValue
if (boundSet) {
real minVal = attType.minValue
setMinValue(destAttType, minVal, true)
}
boundSet = attType.maxValue
if (boundSet) {
real maxVal = attType.maxValue
setMaxValue(destAttType, maxVal, true)
}
}
else if (baseType == "Integer") {
destAttType = create(attType.name, attrInteger, errMsg)
boundSet = attType.minValue
if (boundSet) {
int minVal = attType.minValue
setMinValue(destAttType, minVal, true)
}
boundSet = attType.maxValue
if (boundSet) {
int maxVal = attType.maxValue
setMaxValue(destAttType, maxVal, true)
}
}
else if (baseType == "Date") {
destAttType = create(attType.name, attrDate, errMsg)
boundSet = attType.minValue
if (boundSet) {
Date minVal = attType.minValue
setMinValue(destAttType, minVal, true)
}
boundSet = attType.maxValue
if (boundSet) {
Date maxVal = attType.maxValue
setMaxValue(destAttType, maxVal, true)
}
}
else if (baseType == "String") {
destAttType = create(attType.name, attrString, errMsg)
}
else if (baseType == "Text") {
destAttType = create(attType.name, attrText, errMsg)
}
else if (baseType == "Enumeration") {
string optionshttp://attType.size
int valshttp://attType.size
int colshttp://attType.size
bool keepVals = false
for (i = 0; i < attType.size; i++) {
options[i] = attType.strings[i]
vals[i] = attType.values[i]
cols[i] = attType.colors[i]
if (i != vals[i]) {
keepVals = true
}
}
if (keepVals) {
destAttType=create(attType.name, options, vals, cols, errMsg)
} else {
destAttType=create(attType.name, options, errMsg)
}
} else {
storeMsg("\tUnable to create type '" attType.name "' due to unknown base type '" baseType "'")
}
if (null errMsg) {
passed = true
if(get(accessOptnDBE)==true) { //modify access rights if true
modTypeAccess(srcMod, destMod, attType, destAttType)
}
} else {
storeMsg("\tUnable to create type:\n" errMsg)
}
return passed
} // createType

Can someone help me? Thanks a lot!